package txc.test.web.dto;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;


@JsonInclude(value = Include.NON_NULL)
public class CriteriaDTO {

	// @JsonProperty(required = true)
	private Integer category;
	// main or search
	private String module = "main";
	private String keywords;

	private List<Integer> subcat;
	@JsonProperty("prices")
	private String priceRange;
	private String sortBy = "sort|desc";
	private String direct;
	@JsonProperty(required = true)
	private int pageNo = 1;
	@JsonProperty(required = true)
	private int pageSize = 19;
	private Integer brandId; // 供应商ID

	private List<Integer> type;

	public Integer getCategory() {
		return category;
	}

	public void setCategory(Integer category) {
		this.category = category;
	}

	// public String getSubcat() {
	// return subcat;
	// }
	//
	// public void setSubcat(String subcat) {
	// this.subcat = subcat;
	// }

	public String getPriceRange() {
		return priceRange;
	}

	/**
	 * @return the module
	 */
	public String getModule() {
		return module;
	}

	/**
	 * @param module
	 *            the module to set
	 */
	public void setModule(String module) {
		this.module = module;
	}

	public void setPriceRange(String priceRange) {
		this.priceRange = priceRange;
	}

	public String getSortBy() {
		return sortBy;
	}

	public void setSortBy(String sortBy) {
		if (StringUtils.isBlank(sortBy)) {
			sortBy = "sort|desc";
		}
		this.sortBy = sortBy;
	}

	public String getDirect() {
		return direct;
	}

	public void setDirect(String direct) {
		this.direct = direct;
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		if (pageSize > 100) {
			this.pageSize = 19;
		}
		this.pageSize = pageSize;
	}

	public List<Integer> getSubcat() {
		return subcat;
	}

	public void setSubcat(List<Integer> subcat) {
		this.subcat = subcat;
	}

	public List<Integer> getType() {
		return type;
	}

	public void setType(List<Integer> type) {
		if (type != null && type.size() > 0) {
			this.type = type;
		}
	}

	public Integer getBrandId() {
		return brandId;
	}

	public void setBrandId(Integer brandId) {
		this.brandId = brandId;
	}

	/**
	 * @return the keywords
	 */
	public String getKeywords() {
		return keywords;
	}

	/**
	 * @param keywords
	 *            the keywords to set
	 */
	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	// public String getType() {
	// return type;
	// }
	//
	// public void setType(String type) {
	// this.type = type;
	// }

}
